package com.ict.web.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ict.common.utils.DateUtils;
import com.ict.common.utils.bean.BeanUtils;
import com.ict.common.utils.uuid.IdUtils;
import com.ict.web.domain.Performance;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * 公告对象 yzq_performance
 *
 * @author xss
 * @date 2022-02-17
 */
@Data
public class UpdatePerformanceDto {

    @ApiModelProperty(value = "绩效名称")
    private String perName;

    @ApiModelProperty(value = "适用范围:{0项目绩效1专家绩效}")
    private String rangeApplication;

    @ApiModelProperty(value = "绩效指标")
    private List<InsertPerIndicatorsDto> insertPerIndicatorsDtoS;

    public static Performance of(UpdatePerformanceDto updateDto){
        Performance bean = new Performance();
        BeanUtils.copyProperties(updateDto,bean);
        //设置更新时间和更新时间
        bean.setUpdateTime(DateUtils.getNowDate());
        bean.setCreateTime(DateUtils.getNowDate());
        //设置删除状态

        bean.setPerId(IdUtils.snowId());
        bean.setDelFlag(Performance.DELETE_STATUS_NORMAL);
        bean.setPerName(updateDto.getPerName());
        bean.setPreStatus(Performance.PER_STATUS_NotENABLE);
        bean.setRangeApplication(updateDto.getRangeApplication());

        return bean;
    }
}
